
<template>
  <mu-paper :z-depth="1" class="lan-loadmore-body">
    <mu-appbar color="primary" class="lan-header">
      <mu-button icon slot="left" v-close>
        <i class="iconfont angle-left iconangle-left"></i>
        <span class="lan-header-back">返回</span>
      </mu-button>积分商城
      <mu-button icon slot="right" @click="searchcontroll = true">
        <span class="text">兑换码</span>
      </mu-button>
    </mu-appbar>
    <mu-container ref="container" class="lan-loadmore-content no-padding">
      <subHeader :name="'100'" :title="'可兑换积分'" :subTitle="'积分兑换不影响总积分排行'"> </subHeader>
      <div class="line-title">
        兑换店铺地址：
      </div>
      <mu-paper
          class="lan-card"
          :z-depth="1"
          v-for="(item,index) in data"
          :key="index"
        >
        <span>{{item.name}}</span>
      </mu-paper>
    </mu-container>
  </mu-paper>
</template>

<script>
import subHeader from "./subHeader"
export default {
  name: "MapShow",
  components:{
    subHeader
  },
  data() {
    return {
      refreshing: false,
      loading: false,
      loaded: false,
      loadAll: false,
      pageSize: 10,
      pageNo: 0,
      totalPage: 1,
      data: [
        {name:'西安市高新区天谷七路 12号'},
        {name:'西安市高新区天谷七路 12号'},
        {name:'西安市高新区天谷七路 12号'},
        {name:'西安市高新区天谷七路 12号'},
        {name:'西安市高新区天谷七路 12号'},
        ],
      detailController: false,
      Detail: {},
      searchcontroll: false,
      form: {
        projectId: "",
        startMeetTime: "",
        endMeetTime: "",
        meetType: "",
        meetName: ""
      },
      typeList: [
        { value: "1", name: "质量周例会" },
        { value: "2", name: "质量专项检查会" },
        { value: "3", name: "其他" }
      ],
      projectList: []
    };
  },
  async created() {
    // this.getData(this.form);
    // this.projectList = await this.$A.comData("projectList");
  },
  methods: {
    async refresh() {
      this.refreshing = true;
      this.pageNo = 0;
      this.totalPage = 1;
      this.loaded = false;
      this.loadAll = false;
      this.data = [];
      this.$refs.container.scrollTop = 0;
      await this.getData(this.form);
      this.refreshing = false;
    },
    search() {
      this.loaded = false;
      this.loadAll = false;
      this.pageSize = 10;
      this.pageNo = 0;
      this.totalPage = 1;
      this.data = [];
      this.searchcontroll = false;
      this.getData(this.form);
    },
    clearSearch() {
      this.form = {
        projectId: "",
        startMeetTime: "",
        endMeetTime: "",
        meetType: "",
        meetName: ""
      };
    },
    async getData(params) {
      if (this.pageNo >= this.totalPage) {
        this.loadAll = true;
        return;
      }
      this.$openLoading();
      if (!this.loadAll) {
        this.pageNo += 1;
      } else {
        return;
      }
      let obj = {
        obj: {
          // "orgId":this.$A.GS('orgInfo')['orgId'],
          // "type":this.$A.GS('orgInfo')['type'],
        },
        pageNo: this.pageNo,
        pageSize: this.pageSize
      };
      if (params) {
        Object.assign(obj.obj, params);
      }
      this.$A.Go('post','/safety/meeting/select',obj).then(success=>{
          if(success.code == 200){
            let data = success.body.rows || []
            let total = success.body.page.rows || '0'
            this.totalPage = Math.ceil(total/this.pageSize)
            // let data =  []
            // let total = 0
            if(this.pageNo == 1){
              this.data = data;
            }else{
              this.data.push(...data);
            }
            if(total == 0 || Math.ceil(total/this.pageSize) <= this.pageNo || data.length <= 0){
              this.loadAll = true;
            }
          } else {
            this.data = [];
          }
          this.loaded = true;
          this.$closeLoading();
        },
        function(err) {
          console.warn(err);
        }
      );
    },
    async load() {
      this.loading = true;
      await this.getData(this.form);
      this.loading = false;
    },
    goDetail(list) {
      this.$A.comData('meetLook',list.id)
      this.Detail = list;
      this.detailController = true;
    },
    handurl(str) {
      if (!str) {
        return [];
      } else {
        return str.split(",");
      }
    },
    loadFile(list) {
      let a = document.createElement("a");
      a.setAttribute("href", list.url);
      a.setAttribute("download", list.name);
      a.click();
    }
  }
};
</script>

<style lang="scss" scoped>
.line-title{
  height:0.75rem;
  width:100%;
  font-size:0.17rem;
  display: flex;
  align-items: center;
  padding:0 0.15rem;
}
.img-box {
  img {
    width: 80px;
    height: 80px;
    float: left;
    margin: 5px 8px;
  }
}
.lan-form-title {
  line-height: 40px;
}
</style>
